package com.darker.secking.controller;

import com.darker.secking.entity.User;
import com.darker.secking.service.IOrderService;
import com.darker.secking.vo.DetailVo;
import com.darker.secking.vo.OrderDetailVo;
import com.darker.secking.vo.RespBean;
import com.darker.secking.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author darker
 * @since 2022-10-06
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService orderService;
    @RequestMapping(value = "/detail",produces = "application/json;charset=utf-8")
    @ResponseBody
    public RespBean detail(User user,Long orderId){
        if(null==user) return RespBean.error(RespBeanEnum.LOGIN_ERROR);

        OrderDetailVo orderDetailVo= orderService.findDetail(orderId);
        return RespBean.success(orderDetailVo);

    }
}
